package com.chentf.demo3;

import java.math.BigDecimal;

/**
 * @author chentengfei
 * @desc 使用抽奖器抽奖
 * @date 2025-02-06 22:36:21
 */
public class MainClass {

    public static void main(String[] args) {
        // 创建抽奖器对象，指定数据类型
        ProductGetter<String> stringProductGetter = new ProductGetter<>();
        String[] strProducts = {"手机","电脑","汽车","飞机"};
        // 给抽奖器中填充商品
        for (int i = 0; i < strProducts.length; i++) {
            stringProductGetter.addProduct(strProducts[i]);
        }
        // 抽奖
        String product = stringProductGetter.getProduct();
        System.out.println("恭喜您！您抽中了：" + product);

        System.out.println(">>>>>>>>>>>>>>>>>>>>");

        ProductGetter<Integer> integerProductGetter = new ProductGetter<>();
        Integer[] integerProducts = {1000,2000,5000,10000,5000};
        for (int i = 0; i < integerProducts.length; i++) {
            integerProductGetter.addProduct(integerProducts[i]);
        }
        Integer product1 = integerProductGetter.getProduct();
        System.out.println("恭喜您！您抽中了：" + product1);
    }
}
